package lab02.test21;

/**
 * Created by JAVA on 2017/10/29.
 */
public class Test {
    public static void main(String[] args) {
        //统计一个字符串中给定字符出现的频率
        String string = "abcdefghigkabc";
        char special = 'c';
        int number = 0;
        for (int i = 0; i< string.length(); i++){
            if (string.charAt(i) == special){
                number++;
            }
        }
        System.out.println("在字符abcdefghigkabc中 c出现的频率为："+number);
    }
}
